1. Field of the Invention
The present invention relates generally to the field of computer graphics and pertains more particularly to an apparatus for and a method of converting height fields into parametric texture maps in a computer graphics system.
2. Discussion of the Prior Art
Modem computer systems have become increasingly graphics intensive. Dedicated special purpose memories and hardware have been developed to meet this need. A conventional computer graphics system includes a display device having a two-dimensional (2D) array of light emitting areas. The light emitting areas are usually referred to as pixels which is an abbreviation for picture elements. Such a graphics system typically employs hardware, software, or both to generate a 2D array of values that determine the colors or shades of grey that are to be emitted from the corresponding pixels of the display.
Computer graphics systems are commonly employed for the display of three-dimensional (3D) objects. Typically, such a system generates what appears to be a 3D object on a 2D display by generating 2D views of the 3D object that is modeled in the computer memory. The 2D view of a 3D object which is generated at a particular time usually depends at least on a spatial relationship between the 3D object and a viewer of the 3D object at the particular time.
The process by which a computer graphics system generates the values for a 2D view of a 3D object is commonly referred to as image rendering or scan conversion. The graphics system usually renders a 3D object by subdividing the 3D object into a set of polygons and rendering each of the polygons individually.
The values for a polygon that are rendered for a particular view direction usually depend on the surface features of the polygon and the effects of lighting on the polygon. The surface features include details such-as surface colors and surface structures. The effects of lighting usually depend on a spatial relationship between the polygon and one or more light sources. Typically, the evaluation of the effects of lighting on an individual pixel in a polygon for a particular view direction involves a number of 3D vector calculations. One of ordinary skill in the art will-recognize that the standard Blinn/Phong lighting equation is as follows:
I=kaIa+kdId(Nxc2x7L)+ksIs(Nxc2x7H)nxe2x80x83xe2x80x83(1)
where ka, kd, and ks are constants. Equation (1) states that the light intensity I for a particular pixel is a function of the sum of the ambient contribution Ia, the diffuse contribution Id, and the specular contribution Is at that location.
One conventional method for rendering features that are smaller than the area of a polygon is to employ what is commonly referred to as a texture map. A typical texture map is a table that contains a pattern of color values for a particular surface feature. Unfortunately, texture mapping usually yields relatively flat surface features that do not change with the view direction or light source direction. The appearance of real 3D objects, on the other hand, commonly do change with the view direction, light source direction, or both. These directional changes are commonly caused by 3D structures on the surface of the object, that is, the object is not perfectly flat. Such structures can cause localized shading or occlusions or changes in specular reflections from a light source. The effects can vary with view direction for a given light source direction and can vary with light source direction for a given view direction. These directional changes should be accounted for to provide greater realism in the rendered 2D views.
One conventional method for handling the directional dependence of such structural effects in a polygon surface is to employ what is commonly referred to as a bump map. Bump mapping is based on the realization that the effect of surface structures on the perceived intensity is primarily due to the effect of the structure on the surface normal rather than their effect on the position of the surface. Therefore, one can obtain a good effect by having a texturing function which performs a small perturbation on the direction of the surface normal before using the normal in Equation (1). The normal vector perturbation is defined in terms of a function which gives the displacement of the irregular surface from the ideal smooth one. A typical bump map contains a height field from which a pattern of 3D normal vectors for a surface are extracted. The normal vectors are used to evaluate lighting equations at each pixel in the surface. Unfortunately, such evaluations typically involve a number of expensive and time consuming 3D vector calculations including division and square roots. This can result in decreased rendering speed or increased graphics system cost.
A definite need exists for a system having an ability to meet the efficiency requirements of graphics intensive computer systems. In particular, a need exists for a system which is capable of employing height fields in a skillful manner. Ideally, such a system would have a lower cost and a higher productivity than conventional systems. With a system of this type, system performance can be enhanced. A primary purpose of the present invention is to solve this need and provide further, related advantages.
A graphics system is disclosed that employs parametric texture maps that are converted from height fields. The system samples a hemisphere equidistantly to produce an array of normals, approximates a dot product of each sampled normal with an arbitrary unit vector, transforms the polynomials back to canonical basis, converts a height field to nornmals, and for each normal in the height field determines coefficients for a parametric texture map. The system then evaluates a diffuse contribution using the parametric texture map coefficients. The system may also then evaluate a specular contribution using the parametric texture map coefficients. The graphics system renders surface features of a 3D object in a manner that is direction dependent but without the time consuming and expensive calculations involved in the evaluation of lighting equations on a per pixel basis. A parametric texture map holds a set of parameters that define a surface structure in a manner in which the appearance of the surface structure varies in response to a direction vector. The direction vector may be any user-defined vector including a light source vector or a half-angle vector. The parameters are those of a predetermined equation, the evaluation of which does not involve vector calculations. The equation may take any form including a polynomial equation or a non-polynomial equation. The graphic system renders a polygon with the surface structure using the equation.